﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FrienDev.Data;

namespace FrienDev.BusinessRules
{
    public class FeedBackRules
    {
        private static FeedBackRules _instance;

        public static FeedBackRules Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new FeedBackRules();
                }
                return _instance;
            }
        }


        private FrienDevDataContext m_DataContext = FrienDevDataContext.Instance;

        private FeedBackRules()
        {
        }

        /// <summary>
        /// 插入新反馈
        /// </summary>
        /// <param name="type"></param>
        /// <param name="content"></param>
        /// <param name="contact"></param>
        /// <param name="userId"></param>
        public void InsertFeedBack(short type, string content, string contact, string userId)
        {
            Feedback feedback = new Feedback
            {
                FeedbackType = type,
                Content = content,
                Contact = contact,
                UserId = userId
            };
            m_DataContext.Feedbacks.InsertOnSubmit(feedback);
            m_DataContext.SubmitChanges();
        }
    }
}
